package org.cpoy.ei.session;

import org.cpoy.eims.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("studentList")
public class StudentList extends EntityQuery<Student> {

	private static final String EJBQL = "select student from Student student";

	private static final String[] RESTRICTIONS = {
			"lower(student.firstName) like lower(concat(#{studentList.student.firstName},'%'))",
			"lower(student.lastName) like lower(concat(#{studentList.student.lastName},'%'))",
			"lower(student.passportPhotoUrl) like lower(concat(#{studentList.student.passportPhotoUrl},'%'))", };

	private Student student = new Student();

	public StudentList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Student getStudent() {
		return student;
	}
}
